package com.eastfair.venuebooking.service.impl;

import com.eastfair.core.context.ContextUtil;
import com.eastfair.venuebooking.dao.ProjectExhibitionMapper;
import com.eastfair.venuebooking.entity.PriceListSpace;
import com.eastfair.venuebooking.entity.ProjectExhibition;
import com.eastfair.venuebooking.service.ProjectExhibitionService;
import com.eastfair.boot.service.SuperServiceImpl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.eastfair.constant.BusinessConstant;
import com.eastfair.core.base.R;
import java.util.Collection;
//import com.baomidou.dynamic.datasource.annotation.DS;
/**
 * <p>
 * 业务实现类
 * 
 * </p>
 *
 * @author linan
 * @date 2022-06-08
 */
@Slf4j
@Service
public class ProjectExhibitionServiceImpl extends SuperServiceImpl<ProjectExhibitionMapper, ProjectExhibition> implements ProjectExhibitionService {


    /**
     * 处理逻辑删除相关处理
     *
     * @param modelList 实体
     * @return 是否成功
     */
    @Override
    protected R<Boolean> handlerRemoveByIdsOfLogic(Collection<ProjectExhibition> modelList) {
        modelList.stream().forEach(s -> {
            s.setIsDeleted(BusinessConstant.YES);
        });
        // TODO: 2021/10/29 这里需要操作其他业务，如清空角色等
        return R.successDef();
    }


    @Override
    protected R<Boolean> handlerSave(ProjectExhibition model) {
        model.setProjectId(ContextUtil.getProjectId());
        model.setTenantId(ContextUtil.getTenantId());
        model.setSubsystemId(ContextUtil.getSubSystemId());
        return R.successDef();
    }

    @Override
    public String queryProjectName(Long exhibitionId) {
        return baseMapper.queryProjectName(exhibitionId);
    }
}
